package pkg;

public class Demo1 {
	public static void main(String[] args) {
		Father f = new Father();
		Son s = new Son();
		f.setName("Jack");
		f.setAge(50);
		f.work();
		f.drive();
		s.setName("Ben");
		s.setAge(18);
		s.study();
		//s.play();//私有方法不能调用！！！
	}
}

class Father {
	private int age;
	private String name;
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void work() {
		System.out.println("father is working...");
	}
	public void drive() {
		System.out.println("father is driving...");
	}
}

class Son {
	protected int age;
	public String name;
	
	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	private void play() {
		System.out.println("son is playing...");
	}
	public void study() {
		System.out.println("son is studing...");
	}
}